from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String

Base = declarative_base()

class CollectionLog(Base):
    __tablename__ = 'collection_log'
    id = Column(Integer, primary_key=True)
    collection_source = Column(String(255))
    execute_time = Column(Integer)
    add_num = Column(Integer)
    collection_num = Column(Integer)
    level = Column(Integer)
    message = Column(String)

    def __init__(self, collection_source, execute_time, add_num, collection_num,level,message=''):
        self.collection_source = collection_source
        self.execute_time = int(execute_time)
        self.add_num = int(add_num)
        self.collection_num = int(collection_num)
        self.level = int(level)
        self.message = message

# engine = create_engine("mysql+pymysql://root:@127.0.0.1:3306/cqssc", max_overflow=5)
